﻿using System;
using System.Text;
using System.Data;
using System.Data.OleDb;
using System.Collections.Generic;
using System.Reflection;

namespace Data
{
    public class LotteryAnnouncementMy
    {
        /// <summary>
        /// 主键
        /// </summary>
        private readonly string primaryKey = "id";
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public long Add(Model.LotteryAnnouncementMy model)
        {
            return new DataAccess().Add<Model.LotteryAnnouncementMy>(model, primaryKey);
        }
        public Model.LotteryAnnouncementMy GetModelBysql(string sql)
        {
            return new DataAccess().Get<Model.LotteryAnnouncementMy>(sql);
        }
        public List<Model.LotteryAnnouncementMy> GetPageListBysqlfrom(int PageIndex, int PageSize, string strWhere, string fromTable)
        {
            return new DataAccess().GetPage_List_from<Model.LotteryAnnouncementMy>(PageIndex, PageSize, primaryKey, primaryKey + " desc", strWhere, fromTable);
        }
        public List<Model.LotteryAnnouncementMy> GetPageListWhere(int PageIndex, int PageSize, string sql, out int totalCount)
        {
            totalCount = new DataAccess().GetCount<Model.LotteryAnnouncementMy>(primaryKey, sql);
            return new DataAccess().GetPage_List<Model.LotteryAnnouncementMy>(PageIndex, PageSize, primaryKey, "State asc", sql);
        }
        public DataTable GetPageListBysql(string sql)
        {
            return DbHelp.ExecuteDataset(DBConfig.ConnectionSettings, CommandType.Text, sql, null).Tables[0];
        }
    }
}
